package csl.blog.client.service;

import csl.blog.client.service.fallback.ConsumerServiceFallback;
import csl.blog.common.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Interface consumerServer
 * @Description TODO
 * @Author 隔山海
 * @Date 2021/7/20 11:11
 * @Version 1.0
 **/
@Service("consumerServer")
@FeignClient(value = "blog-server-client",fallback = ConsumerServiceFallback.class) //开启熔断-服务降级（快速失败）
public interface ConsumerService {

    @PostMapping("/add")
    int add(@RequestBody User user);

    @GetMapping("/queryByCondition/{userId}")
    List<User> queryByCondition(@PathVariable String userId);
}
